#include <iostream>
#include <string>
using namespace std;

int main(){
	string str;
	cin >> str;
	char res[str.length()+1];
	int flag = 0;
	int c = 0;
	for(int i=0; i<str.length(); i++){
		if( str[i]=='(') flag++;		
		if( flag==0 ){
			if( str[i]=='<') c--;
			else res[c++] = str[i];
		} 
		if( str[i]==')') flag--;
	}
	res[c++] = '\0';
	cout << res;
	return 0;
}
